package com.luck.org.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import com.luck.pf.util.FormateUtil;

/**
 * @hibernate.class table="SYS_ROLE"
 * 说明:
 * Copyright: Copyright (c) 2010
 * @author zhangwenrui 2010-8-4 下午03:04:28
 * @version 1.0
 */
public class SysRole implements Serializable {
	private static final long serialVersionUID = -6217665241097384378L;
	private Long id;//角色id
	private String roleName;//角色名称
	private String roleNote;//角色的描述
	private Long deptId;//机构ID
	private SysDepartment dept;
	private String roleLevel;//级别，对应机构的级别,0:为顶级
	private Long operUser;//操作人
	private Date operTime;//操作时间
	private Set users;//对应的用户列表
	private Set menus;//对应的用户列表
	
	/**
     * @hibernate.id generator-class = "sequence" 
     * @hibernate.generator-param name="sequence" value="seq_sys_role"
     * @hibernate.column sql-type="NUMBER(22,0)" name="id"
     * @return
     */
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	/**
     * @hibernate.property length="20" column="role_name"
     */
	public String getRoleName() {
		return roleName;
	}
	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}
	/**
     * @hibernate.property length="100" column="role_note"
     */
	public String getRoleNote() {
		return roleNote;
	}
	public void setRoleNote(String roleNote) {
		this.roleNote = roleNote;
	}
	/**
     * @hibernate.property length="2" column="role_level"
     */
	public String getRoleLevel() {
		return roleLevel;
	}
	public void setRoleLevel(String roleLevel) {
		this.roleLevel = roleLevel;
	}

	/**
     * @hibernate.property length="16" column="oper_user"
     */
	public Long getOperUser() {
		return operUser;
	}
	public void setOperUser(Long operUser) {
		this.operUser = operUser;
	}
	/**
     * @hibernate.property column="oper_time"
     */
	public Date getOperTime() {
		return operTime;
	}
	public void setOperTime(Date operTime) {
		this.operTime = operTime;
	}
	/**
     * @hibernate.property column="dept_id"
     */
	public Long getDeptId() {
		return deptId;
	}
	public void setDeptId(Long deptId) {
		this.deptId = deptId;
	}
    /**
     * @hibernate.many-to-one class = "com.luck.org.entity.SysDepartment" column="dept_id" insert="false" update="false"
     * @return
     */
	public SysDepartment getDept() {
		return dept;
	}
	public void setDept(SysDepartment dept) {
		this.dept = dept;
	}
	/**
     * @hibernate.set name="person" table="sys_user_role" cascade="none" inverse="false"
     * @hibernate.collection-key column="role_id" 
     * @hibernate.collection-many-to-many class="com.luck.org.entity.SysUser" column="user_id"
     */
	public Set getUsers() {
		return users;
	}
	public void setUsers(Set users) {
		this.users = users;
	}
	/**
     * @hibernate.set name="person" table="sys_role_menu" cascade="none" inverse="false"
     * @hibernate.collection-key column="role_id" 
     * @hibernate.collection-many-to-many class="com.luck.org.entity.SysMenu" column="menu_id"
     */
	public Set getMenus() {
		return menus;
	}
	public void setMenus(Set menus) {
		this.menus = menus;
	}

	public String getRoleLevelStr() {
		return FormateUtil.getInstance().getNameByCode("p_dept_level", this.roleLevel);
	}

}
